#include "LevelRule.h"

void cLevelRule::AddConditionStatement( const cStatement &lStatement)
{
  mConditions.push_back(lStatement);
}

void cLevelRule::AddActionStatement( const cStatement &lStatement)
{
  mActions.push_back(lStatement);
}

void cLevelRule::EvalRule()
{
  bool lbCondition = true;
  for (cStatementListIt lcIt = mConditions.begin(); lcIt != mConditions.end(); lcIt++)
    lbCondition = lbCondition && (*lcIt).Eval();

  if (lbCondition)
    for (cStatementListIt lcIt = mActions.begin(); lcIt != mActions.end(); lcIt++)
      (*lcIt).Do();
}

//Destructor
cLevelRule::~cLevelRule()
{
  //Clear the list
  mConditions.clear();
}